//1.联合类型
function getLength(args: string | any[]) {
  return args.length
}
console.log(getLength("yzhyzhzyhzyzh"));
console.log(getLength([1,2,3,4,5]));


//2.函数重载
function getLength2(args: string): number;
function getLength2(args: any[]): number;

function getLength2(args: any): number {
  return args.length
}
console.log(getLength2("abc"));
console.log(getLength2([1,2,3]));

